package io.renren.modules.sys.service.impl;

import io.renren.modules.sys.entity.ProductshelvesstcokVOEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.ProductshelvesstcokDao;
import io.renren.modules.sys.entity.ProductshelvesstcokEntity;
import io.renren.modules.sys.service.ProductshelvesstcokService;


@Service("productshelvesstcokService")
public class ProductshelvesstcokServiceImpl extends ServiceImpl<ProductshelvesstcokDao, ProductshelvesstcokEntity> implements ProductshelvesstcokService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ProductshelvesstcokEntity> page = this.page(
                new Query<ProductshelvesstcokEntity>().getPage(params),
                new QueryWrapper<ProductshelvesstcokEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ProductshelvesstcokEntity getByProductIdAndShelvesId(Integer productId,Integer shelvesid){
        ProductshelvesstcokEntity productshelvesstcokEntity = baseMapper.getByProductIdAndShelvesId(productId,shelvesid);
        return productshelvesstcokEntity;
    }

    @Override
    public List<ProductshelvesstcokVOEntity> getProductStockByProductId(Integer productId){
        List<ProductshelvesstcokVOEntity> list = baseMapper.getProductStockByProductId(productId);
        return list;
    }

}
